local function getPath(uri)
    local filepath = '';
    local pos;
    while(true)do
        local ps,pe,prefix,c = uri:find('([^%%]+)%%(.?.?)',pos)
        if(ps==nil)then
            ps,pe,prefix = uri:find('(.*)',pos)
            filepath = filepath .. prefix;
            break;
        end
        if(c:sub(1,1)=='%')then
            filepath = filepath .. prefix .. '%';
            pos = pe + 1;
        else
            filepath = filepath .. prefix .. string.char( tonumber('0x'..c));
            pos = pe + 1;
        end
    end
    local ps,pe,path = filepath:find('file:/*(.+)');
    return path;
end

print(getPath('file:///d%3A/aaaa/xx/aa.c'));
